{php include wl_template('common/header');}
<style type='text/css'>
	.trbody td{text-align: center;vertical-align:top;border-left:1px solid #ccc;border-bottom: 1px solid #ddd;}
	.order-rank img{width:16px;height:16px;}
	.js-remark,.js-admin-remark{word-break:break-all;overflow:hidden;background: #FDEEEE;color: #ED5050;padding: 5px 10px;}
	td.goods-info{position:relative;padding-left:60px;}
	.goods-info .img{position:absolute;top:50%;margin-top:-25px;background: url({IMAGE_LOADING}
	) center center no-repeat;width:50px;height:50px;}
	.goods-info span{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;}
	.status-text{cursor:pointer;}
	.col-md-1{padding-right: 0px;}
	.all-tips{margin-left: 65px;}
	span.effect-time{font-size: 12px;display: block;font-weight: 500;}
	.row.row-fix, .form-group.form-group-fix{margin-left: -15px;margin-right: -15px;width: 500px;}
	button.btn.btn-default.daterange.daterange-date{float: left;margin-left: 234px;position: absolute;z-index: 100;}
	#sel_child{z-index: 10;width: 200px;position: absolute;display: none;}
	.show1{display: block;}
	.hide1{display: none;}
	.daterange-date{display: none;}
	.sty{display: block;width: 100%;font-size: 13px;height: 46px;overflow: hidden;white-space: nowrap;line-height: 46px;text-overflow: ellipsis;text-align: center;}
	.spe{display: inline-block;text-align: center;display: block;height: 33px;margin-left: -12px;padding-top: 0px;line-height: 33px;}
	.table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{white-space: normal;}
	span.ppp{text-align: center;display: inline-block;font-size: 14px;width: 100%;overflow: hidden;text-overflow: ellipsis;color: #e43;}
	select#sel_parent{z-index: 1000;}
	.nickname{margin-left: 94px;height: 34px;width: 200px;}
	.col-xs-12.col-sm-6.col-sm-9.col-lg-6{z-index: 9999;}
	.start-time{font-size: 12px;}
	.end-time{font-size: 12px;}
	.mouth{margin-left: 94px;height: 34px;width:130px;display: none;}
</style>
<ul class="nav nav-tabs" id="myTab">
	<li class="active"><a href="#">商家大礼包</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-action"><a href="{php echo web_url('halfcard/halfcard_web/createpackage');}" class="btn btn-primary">添加大礼包</a></div>
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{MODULE_NAME}" />
				<input type="hidden" name="p" value="halfcard" />
				<input type="hidden" name="ac" value="halfcard_web" />
				<input type="hidden" name="do" value="packagelist" />
				<input type="hidden" name="status" value="{$_GPC['status']}" />
				<div class="form-group">
					<label class="col-sm-2 control-label">礼包状态</label>
					<div class="col-sm-9">
						<div class="btn-group">
							<a href="{php echo wl_filter_url('status:0');}" class="btn {if intval($_GPC['status']) == 0}btn-primary{else}btn-default{/if}">不限</a>
							<a href="{php echo wl_filter_url('status:1');}" class="btn {if $_GPC['status'] == 1}btn-primary{else}btn-default{/if}">启用中</a>
							<a href="{php echo wl_filter_url('status:4');}" class="btn {if $_GPC['status'] == 4}btn-primary{else}btn-default{/if}">未启用</a>
							<a href="{php echo wl_filter_url('status:2');}" class="btn {if $_GPC['status'] == 2}btn-primary{else}btn-default{/if}">审核中</a>
							<a href="{php echo wl_filter_url('status:3');}" class="btn {if $_GPC['status'] == 3}btn-primary{else}btn-default{/if}">被驳回</a>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">礼包标题</label>
                    <div class="col-md-4">
                        <input type="text" name="keyword" class="form-control" value="{$_GPC['keyword']}"  placeholder="请输入关键字"/>
                    </div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<button class="btn btn-primary" id="search">筛选</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="app-table-list">
		<div class="panel-body table-responsive collapse in" id="order-template-item-4" style="padding: 0;">
			<table class="table table-bordered table-hover order-list">
				<thead style="background-color: #FFFFFF;">
				<tr>
					<th style="width:190px;text-align:center;">礼包信息</th>
					<th style="width:150px; text-align:center;">限制简介</th>
					<th style="width:120px; text-align: center;">属性</th>
					<th style="width:60px; text-align: center;">领取</th>
					<th style="width:150px;text-align:center;">活动时间</th>
					<th style="width:90px; text-align: center;">状态</th>
					<th style="width:150px; text-align:center;">操作</th>
				</tr>
				</thead>
				<tbody >
				{loop $packagelist $y $item}
				<tr>
					<td class="goods-info line-feed" style="width:190px;padding-left: 10px;">
						<div class="img"><img src="{IMAGE_PIXEL}" class="scrollLoading" data-url="{php echo tomedia($item['logo'])}" height="50" width="50" ></div>
						<div class="all-tips">
							<span class="" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">
							<a style="color: #428bca;" data-href="{php echo web_url('halfcard/halfcard_web/changeinfo',array('id' => $item['id'],'type'=>1))}" href="javascript:;" title="修改活动名" data-toggle="ajaxEdit" >{$item['title']}</a>
							<p style="margin: 0;">{$item['storename']}</p>
							</span>
						</div>
					</td>
					<td class="text-center" style="width:150px;height:60px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">
					<a style="color: #428bca;" data-href="{php echo web_url('halfcard/halfcard_web/changeinfo',array('id' => $item['id'],'type'=>5))}" href="javascript:;" title="修改简介" data-toggle="ajaxEdit" >{$item['limit']}</a>
					</td>
					{if !is_store()}
					<td class="text-center" style="width:120px;">
						<p style="margin: 0;">人气:<a style="color: #428bca;" data-href="{php echo web_url('halfcard/halfcard_web/changeinfo',array('id' => $item['id'],'type'=>2))}" href="javascript:;" title="修改人气" data-toggle="ajaxEdit" >{$item['pv']}</a></p>
						<p style="margin: 0;">排序:<a style="color: #428bca;" data-href="{php echo web_url('halfcard/halfcard_web/changeinfo',array('id' => $item['id'],'type'=>3))}" href="javascript:;" title="修改排序" data-toggle="ajaxEdit" >{$item['sort']}</a></p>
					</td>
					{else}
					<td class="text-center" style="width:120px;">
						<p style="margin: 0;">人气:{$item['pv']}</p>
						<p style="margin: 0;">排序:{$item['sort']}</p>
					</td>
					{/if}
					<td class="text-center" style="width:60px;">
						<a style="color: #428bca;" href="{php echo web_url('halfcard/halfcard_web/userhalfcardlist',array('type'=>2,'id'=>$item['id']))}">{$item['givenum']}</a>
					</td>
					<td class="text-center" style="width:150px;">
						{if $item['packtimestatus']}
						<p style="margin: 0;">{$item['datestarttime']}</p>
						<p style="margin: 0;">{$item['dateendtime']}</p>
						{else}
						<p>长期</p>
						{/if}
					</td>
					<td class="text-center" style="width:90px;">
						{if $item['status']==1}<span  class="label label-success">已启用</span>{/if}
						{if $item['status']==0}<span  class="label label-default">已禁用</span>{/if}
						{if $item['status']==2}<span  class="label label-warning">审核中</span>{/if}
						{if $item['status']==3}<span  class="label label-danger">已驳回</span>{/if}
					</td>
					<td class="text-center" style="width:150px;">
						{if $item['status'] == 2 || $item['status'] == 3}
						<a href="javascript:;" class="js-pass" order-id="{$item['id']}" > 通过 -</a>
						{/if}
						{if $item['status'] == 2}
						<a href="javascript:;" class="js-reject" order-id="{$item['id']}" > 驳回 -</a>
						{/if}
						<a href="{php echo web_url('halfcard/halfcard_web/createpackage', array('id' => $item['id']))}" class="js-edit" order-id="{$item['id']}"> 编辑 -</a>
						<a data-toggle="ajaxRemove" href="{php echo web_url('halfcard/halfcard_web/changeinfo',array('id' => $item['id'],'type'=>4))}" data-confirm="确认删除此活动？">删除</a>
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
		<div class="app-table-foot clearfix">
			<div class="pull-left">
				
			</div>
			<div class="pull-right">
				{$pager}
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$("#search").click(function(){
		$('#form1')[0].submit();
	});
</script>
<script type="text/javascript">
	$(function(){
		$('.order-list').delegate('.js-pass', 'click', function(e){
			e.stopPropagation();
			var $this = $(this);
			var id = $this.attr('order-id');
			var flag = 1;
			util.nailConfirm(this, function(state) {
				if(!state) return;
				$.post("{php echo web_url('halfcard/halfcard_web/passHalfcard')}", { id : id , flag : flag, type : 2}, function(data){
					if(!data.errno){
					util.tips("通过成功！");
        			location.reload();
					};
				}, 'json');
			}, {html: '通过审核?'});
		});
		$('.order-list').delegate('.js-reject', 'click', function(e){
			e.stopPropagation();
			var $this = $(this);
			var id = $this.attr('order-id');
			var flag = 0;
			util.nailConfirm(this, function(state) {
				if(!state) return;
				$.post("{php echo web_url('halfcard/halfcard_web/passHalfcard')}", { id : id , flag : flag , type : 2 }, function(data){
					if(!data.errno){
					util.tips("驳回成功！");
        			location.reload();
					};
				}, 'json');
			}, {html: '确认驳回?'});
		});
		
		$('#de1').delegate('.js-delete','click',function(e){
			e.stopPropagation();
			var order_ids = [];
			var $checks=$('.checkbox:checkbox:checked');
			$checks.each(function() {
				if (this.checked) {
					order_ids.push(this.value);
				};
			});
				var $this = $(this);
				var ids = order_ids;
			//	alert(ids);
				util.nailConfirm(this, function(state) {
				if(!state) return;
					$.post("{php echo web_url('halfcard/halfcard_web/deleteHalfcard')}", { ids : ids }, function(data){
						if(!data.errno){
						util.tips("删除成功！");
						location.reload();
						};
					}, 'json');
				}, {html: '确认删除?'});
			});
		});

</script>
{php include wl_template('common/footer');}